package top.kaoshanji.ch03;

import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import top.kaoshanji.ch03.beans.Agent;

import java.util.List;

/**
 * 代码清单 ch03-05：用Guice注入AgentFinder的示例(3.3.1节)
 * @see AgentFinderModule
 * @see HollywoodServiceGuice
 * author kaoshanji
 * ^_^
 * create time 2024/12/14 18:28
 */
public class HollywoodServiceV5 {

    private static final Logger logger = LogManager.getLogger(HollywoodServiceV5.class);

    public static void main(String[] args) {
        logger.info("...代码清单 ch03-05：用Guice注入AgentFinder的示例(3.3.1节)...");

        Injector injector = Guice.createInjector(new AgentFinderModule());
        HollywoodServiceGuice hollywoodService = injector.getInstance(HollywoodServiceGuice.class);
        List<Agent> agents = hollywoodService.getFriendlyAgents();

    }

}
